﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>UserAuthPage</title>
</head>
<body>
    <div>
           <span id="showcode"></span>
    </div>
    <script type="text/javascript">
        GetAuthCode();
        function GetAuthCode() {
            var code = getQueryString('code');
            
            if (code == null || code == "") {
                const pathStr = window.location.href;
                window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx207c528e9c66edb6&redirect_uri=' + encodeURIComponent(pathStr) + '&response_type=code&scope=snsapi_base&state=1#wechat_redirect';
            }
            else {
                alert(code);
            }
        }


        function getQueryString(name) {
            var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
            var r = window.location.search.substr(1).match(reg);
            if (r != null) {
                return unescape(r[2]);
            }
            return null;
        }
    </script>
</body>
</html>
